package com.bawei.park2211a.adapter

import android.widget.TextView
import com.bawei.base.bean.ReqairEntity
import com.bawei.park2211a.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import org.w3c.dom.Text

class ReqairAdapter : BaseQuickAdapter<ReqairEntity, BaseViewHolder>(R.layout.item_repair) {
    var arer = ""
    override fun convert(helper: BaseViewHolder, item: ReqairEntity) {
        val view = helper.getView<TextView>(R.id.reqair_state)
        when (item.repairLocation) {
            "1" -> {
                arer = "东区"
            }
            "2" -> {
                arer = "北区"
            }
            "3" -> {
                arer = "南区"
            }
            "4" -> {
                arer = "东区"
            }
            else -> {
                arer = "中央大厅"
            }
        }
        when(item.processingStatus){
            "维修中"->{
                view.setBackgroundResource(R.drawable.text_color3)
            }
            "待处理"->{
                view.setBackgroundResource(R.drawable.text_color2)
            }
            "已完成"->{
                view.setBackgroundResource(R.drawable.text_color1)
            }
        }
        helper.setText(R.id.reqair_time, "保修时间：${item.repairTime}")
        helper.setText(R.id.reqair_info, item.faultDescription)
        helper.setText(R.id.reqair_phone, "联系人：${item.contactMethod}")
        helper.setText(R.id.reqair_state, item.processingStatus)
        helper.setText(R.id.reqair_name, "报修人："+item.repairName)
        helper.setText(R.id.reqair_area, "位置：$arer")
        helper.setText(R.id.repair_number, "工单号：${item.orderNumber}")
    }
}